package store.lunangangster.nodeflow.parser.el;

import com.ql.util.express.ExpressRunner;
import store.lunangangster.nodeflow.context.holder.FlowContextHolder;

/**
 * ExpressRunner的持有器
 *
 * @author cwk
 * @version 1.0
 */
public class ELRunnerHolder {
  private static volatile ExpressRunner runner;

  public static ExpressRunner getRunner() {
    if (runner == null) {
      synchronized (ELRunnerHolder.class) {
        if (runner == null) {
          ExpressRunner expressRunner = FlowContextHolder.getContext().getBean(ExpressRunner.class);
          if (expressRunner == null) {
            runner = new InitializedELRunner();
          } else {
            runner = expressRunner;
          }
        }
      }
    }
    return runner;
  }
}
